#ifndef __UIDLGBUILDER_H__
#define __UIDLGBUILDER_H__

#pragma once

namespace uilib {

class IDlgBuilderCB
{
public:
    virtual CControlUI* CreateControl(LPSTRING pstrClass) = 0;
};


class CDlgBuilder
{
public:
    CDlgBuilder();

	CControlUI* Create(STRINGorID xml, LPSTRING type = NULL, IDlgBuilderCB* pCallback = NULL,
		CPaintManagerUI* pManager = NULL, CControlUI* pParent = NULL);
    CControlUI* Create(IDlgBuilderCB* pCallback = NULL, CPaintManagerUI* pManager = NULL,
        CControlUI* pParent = NULL);

    CMarkup* GetMarkup();

private:
	void SetFont(const XmlNode& node, CPaintManagerUI* pManager);
	void SetImage(const XmlNode& node, CPaintManagerUI* pManager);
	void SetDefault(const XmlNode& node, CPaintManagerUI* pManager);
    CControlUI* _Parse(CMarkupNode* parent, CControlUI* pParent = NULL, CPaintManagerUI* pManager = NULL);




    CMarkup			m_xml;
	XmlDocument		m_doc;
	XmlParseResult	m_result;
    IDlgBuilderCB*	m_pCallback;

};

} 

#endif // __UIDLGBUILDER_H__
